namespace GUI.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class theme : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.SubjectsArticles", "ArticleId", "dbo.Articles");
            DropIndex("dbo.SubjectsArticles", new[] { "ArticleId" });
            CreateTable(
                "dbo.Themes",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Subjects = c.String(),
                        ArticleId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Articles", t => t.ArticleId, cascadeDelete: true)
                .Index(t => t.ArticleId);
            
            DropTable("dbo.SubjectsArticles");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.SubjectsArticles",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Subjects = c.String(),
                        ArticleId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id);
            
            DropIndex("dbo.Themes", new[] { "ArticleId" });
            DropForeignKey("dbo.Themes", "ArticleId", "dbo.Articles");
            DropTable("dbo.Themes");
            CreateIndex("dbo.SubjectsArticles", "ArticleId");
            AddForeignKey("dbo.SubjectsArticles", "ArticleId", "dbo.Articles", "Id", cascadeDelete: true);
        }
    }
}
